#pragma once
#include <string>
#include <vector>
#include "XBasicParseNodes.h"
#include "XVariableParseNode.h"
#include "XConstantParseNode.h"

class XFunctionParser
{
public:
    XFunctionParser();
    ~XFunctionParser();
    std::vector<std::string> getPolandTokenString() const;
    double getFunction(double x = 0.0, double y = 0.0, double z = 0.0);

protected:
    void genParseTree();
    void genTokenStrings();
    void solvePoland();
    std::string polandString;
    std::vector<std::string> polandTokenStrings;
    XAbstractParseNode *root;

    std::vector<XAbstractParseNode *> arrX;
    std::vector<XAbstractParseNode *> arrY;
    std::vector<XAbstractParseNode *> arrZ;
    void dfs(XAbstractParseNode *r);
};

